scale between tow ranges c#

160

scale between tow ranges c# -

public float scale(float OldMin, float OldMax, float NewMin, float NewMax, float OldValue){
 
    float OldRange = (OldMax - OldMin);
    float NewRange = (NewMax - NewMin);
    float NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
 
    return(NewValue);
}

Comments

Submit
0 Comments